import pymysql,os,json


host = "127.0.0.1"

db = pymysql.connect(host,"root","zjmazyzk123456","root", charset='utf8')
cursor = db.cursor()

a1 = np.load("1.npy")
a2 = np.load("2.npy")
a3 = np.load("3.npy")
a4 = np.load("4.npy")
a5 = np.load("5.npy")
a6 = np.load("6.npy")
a7 = np.load("7.npy")
a8 = np.load("8.npy")

for i in range(1): 
	sql = "INSERT INTO book(isbn, name, author, publisher,price,grade,intro, imglink) \
                    VALUES ('%d', '%s', '%s',    '%s',     '%f', '%f', '%s',  '%s' )" % \
           (int(a1[i]),str(a1[i]), str(a3[i]), str(a4[i]), float(a5[i]), float(a6[i]),str(a7[i]), str(a8[i]))
    cursor.execute(sql)
    result = cursor.fetchone()
    print(result)

db.close()
